import React, { lazy } from 'react'
import { Navigate } from 'react-router-dom'
const Home = lazy(() => import('../views/home'))
const Classify = lazy(() => import('../views/classify'))
const My = lazy(() => import('../views/my'))
const ShopCar = lazy(() => import('../views/shopCar'))

const Address = lazy(() => import('../views/address'))
const Detail = lazy(() => import('../views/detail'))
const MainLayout = lazy(() => import('../views/mainLayout'))
const Search = lazy(() => import('../views/home'))
const Signin = lazy(() => import('../views/signin'))
const Payment = lazy(() => import('../views/payment'))
const Upload = lazy(() => import('../views/upload'))
// 二级
export const mainLayoutRoutes = [{
	path: '/home',
	element: <Home></Home>,
	title: '首页'
}, {
	path: '/classify',
	element: <Classify></Classify>,
	title: '分类'
}, {
	path: '/shopcar',
	element: <ShopCar></ShopCar>,
	title: '购物车'
}, {
	path: '/my',
	element: <My></My>,
	title: '我的'
}, {
	path: '/',
	element: <Navigate to="/home"></Navigate>,
	hiddle: true
}]
// 一级
export const routes = [{
	path: '/',
	element: <MainLayout></MainLayout>,
	children: mainLayoutRoutes
}, {
	path: '/address',
	element: <Address></Address>
}, {
	path: '/detail/:id',
	element: <Detail></Detail>
}, {
	path: '/search',
	element: <Search></Search>
}, {
	path: '/signin',
	element: <Signin></Signin>
}, {
	path: '/payment',
	element: <Payment></Payment>
}, {
	path: '/upload',
	element: <Upload></Upload>
}]
